<script>
	import Vue from 'vue';
	// #ifdef APP-PLUS
	import appUpdate from '@/uni_modules/leruge-app-update/js_sdk/leruge-app-update.js';
	// #endif
	export default {
		onLaunch: function() {
			console.log('App Launch')

		},
		onShow: function() {
			console.log('App Show')
			// #ifdef APP-PLUS
			this.upDate()
			// #endif
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			async upDate() {
				const systemInfo = uni.getSystemInfoSync()
				let version = parseInt(systemInfo.appWgtVersion.split(".").join(""))
				// 获取接口 版本号
				let onLineVersion = '1.0.0'
				if (version < onLineVersion) {
					if (systemInfo.platform == 'android') {
						let updateInfo = {
							platform: 'android',
							updateContent: '1.新版本',
							downUrl: '', //下载地址
							version: onLineVersion,
							force: true,
							mainColor: '0c80fb',
						}
						appUpdate(updateInfo)
					} else { //苹果
						let updateInfo = {
							platform: 'ios',
							updateContent: '1.新版本',
							downUrl: 'https://apps.apple.com/cn/app/id6739860791',
							version: res.data.value,
							force: true,
							mainColor: '0c80fb',
						}
						appUpdate(updateInfo)
					}
				}
			},
		}
	}
</script>

<style lang="scss">
	/*每个页面公共css */
	@import "uview-ui/index.scss";
	@import "@/common/custom.scss";

	/* 全局隐藏滚动条 */
	::-webkit-scrollbar {
		width: 0;
		height: 0;
		display: none;
	}

	/* 微信小程序全局穿透 */
	scroll-view ::-webkit-scrollbar {
		width: 0;
		height: 0;
		display: none;
	}
</style>